package com.kcwl.carrier.domain.service;

import com.kcwl.carrier.domain.entity.VehicleBlacklistCondition;
import com.kcwl.carrier.domain.entity.VehicleBlacklistInfo;
import com.kcwl.carrier.domain.repository.IVehicleBlacklistRepository;
import com.kcwl.carrier.infrastructure.repository.po.VehicleBlacklistPO;
import com.kcwl.carrier.interfaces.query.VehicleBlacklistQuery;
import com.kcwl.ddd.domain.entity.KcPage;
import com.kcwl.framework.utils.KcBeanConverter;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Slf4j
@Service
public class VehicleBlacklistDomainService {

    @Resource
    private IVehicleBlacklistRepository vehicleBlacklistRepository;

    public List<VehicleBlacklistInfo> queryVehicleBlacklistList(VehicleBlacklistCondition conditionVo) {
        return vehicleBlacklistRepository.queryVehicleBlacklistList(conditionVo);
    }

    public Long addBlacklist(VehicleBlacklistInfo vehicleBlacklistInfo) {
        return vehicleBlacklistRepository.addBlacklist(KcBeanConverter.toBean(vehicleBlacklistInfo, VehicleBlacklistPO.class));
    }

    public KcPage<VehicleBlacklistInfo> queryVehicleBlacklistPage(VehicleBlacklistQuery query) {
        return vehicleBlacklistRepository.queryVehicleBlacklistPage(query);
    }

    public Boolean updateBlacklist(VehicleBlacklistInfo info) {
        return vehicleBlacklistRepository.updateById(KcBeanConverter.toBean(info, VehicleBlacklistPO.class));
    }
}
